package com.qzxy.premiumhotelsystem.controller.guest;

import com.qzxy.premiumhotelsystem.common.result.PageResult;
import com.qzxy.premiumhotelsystem.domain.dto.RoomStockPageDTO;
import com.qzxy.premiumhotelsystem.domain.dto.RoomsPageDTO;
import com.qzxy.premiumhotelsystem.service.RoomTypesService;
import com.qzxy.premiumhotelsystem.service.RoomsService;
import com.qzxy.premiumhotelsystem.common.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import jakarta.annotation.Resource;

/**
 * ClassName: RoomsController
 * Package: com.qzxy.premiumhotelsystem.controller
 * Description:
 *
 * @Author Qwh
 * @Create 2024/9/12 16:03
 * @Version 1.0
 */

@RestController("userRoomsController")
@RequestMapping("/user/rooms")
@Tag(name = "用户房间相关接口")
@Slf4j
public class RoomsController {

    @Resource
    private RoomsService roomsService;
    @Resource
    private RoomTypesService roomTypesService;


    /**
     * 根据roomTypeId查询房间类型相关信息
     * @param
     * @return
     */
    @Operation(summary = "根据roomTypeId查询房间类型相关信息")
    @GetMapping("/{roomTypeId}")
    public Result selectByRoomNumber(@PathVariable Integer roomTypeId){
        Result result = roomTypesService.selectByRoomTypeId(roomTypeId);
        return result;
    }


    @Operation(summary = "房间类型查询，便于前端通过房间类型关键字来查找房间")
    @GetMapping("/types/all")
    public Result listRoomTypes() {
        log.info("用户查询房间类型");
        Result result = roomTypesService.getRoomTypeList();
        return result;

    }


    @Operation(summary = "查询是否推荐房间类型")
    @GetMapping("/advice/{isAdvice}")
    public Result selectAdviceRoomType(@PathVariable Integer isAdvice) {
        log.info("查询推荐房间类型");
        Result result = roomTypesService.selectAdviceRoomType(isAdvice);
        return result;

    }

    @Operation(summary = "用户根据房间类型得到对应的空闲房间")
    @GetMapping("/getRoomsInType/{roomTypeId}")
    public Result getRoomsInType(@PathVariable Integer roomTypeId) {
        log.info("根据房间类型查询得到具体的房间，roomTypeId：{}",roomTypeId);
        Result result = roomsService.getRoomsInType(roomTypeId);
        return result;
    }


    @Operation(summary = "用户根据roomId查询房间具体信息")
    @GetMapping()
    public Result getRoomsByRoomId(@RequestParam Integer roomId) {
        log.info("根据房间类型查询得到具体的房间，roomId：{}",roomId);
        Result result = roomsService.selectByRoomId(roomId);
        return result;
    }






}

